package ffmvc.model;

import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;

public class PerformanceExtractor implements ResultSetExtractor<Performance> {

	@Override
	public Performance extractData(ResultSet rs) throws SQLException, DataAccessException {
		Performance perf = new Performance();
		perf.setId(rs.getString(1));
		perf.setPlayerId(rs.getString(2));
		perf.setSeason(rs.getString(3));
		perf.setPoints(rs.getDouble(4));
		perf.setWeek(rs.getInt(6));
		perf.setAssists(rs.getInt(8));
		perf.setGoalsAllowed(rs.getInt(9));
		perf.setFoulsWon(rs.getInt(10));
		perf.setYellowCards(rs.getInt(11));
		perf.setPenaltyKickGoals(rs.getInt(12));
		perf.setFoulsCommitted(rs.getInt(13));
		perf.setMatchWinningGoal(rs.getInt(14));
		perf.setBlockedShots(rs.getInt(15));
		perf.setPenaltyKickSaves(rs.getInt(16));
		perf.setTacklesWon(rs.getInt(17));
		perf.setGive(rs.getInt(18));
		perf.setPenaltiesCommitted(rs.getInt(19));
		perf.setShotsOnTarget(rs.getInt(20));
		perf.setRedCard(rs.getInt(21));
		perf.setPassessIntercepted(rs.getInt(22));
		perf.setPenaltyKickMisses(rs.getInt(23));
		perf.setGoals(rs.getInt(24));
		perf.setGamesPlayed(rs.getInt(25));
		perf.setDefeat(rs.getInt(26));
		perf.setTie(rs.getInt(27));
		perf.setWin(rs.getInt(28));
		perf.setCleanSheet(rs.getInt(29));
		perf.setOwnGoals(rs.getInt(30));
		perf.setSetPieceGoals(rs.getInt(31));
		perf.setSaves(rs.getInt(32));
		perf.setCrosses(rs.getInt(33));
		perf.setSalaryReal(rs.getDouble(34));
		perf.setOwned(rs.getDouble(36));
		return perf;
	}

}
